﻿using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using GoShopping.Model;

/// <summary>
///GetRelatedColumn 的摘要说明
/// </summary>
public class GetRelatedColumn
{
    public GetRelatedColumn()
    {
        //
        //TODO: 在此处添加构造函数逻辑
        //
    }
    public static int GetUserID(string userName)
    {
        GoShopping.BLL.UserBean ub = new GoShopping.BLL.UserBean();
        return ub.GetOneUser(userName).ID;
    }
    public static string GetUserName(object userId)
    {
        GoShopping.BLL.UserBean ub = new GoShopping.BLL.UserBean();
        return ub.GetUserName(Convert.ToInt32(userId));
    }
    public static string GetSupplyerName(object supplyerId)
    {
        GoShopping.BLL.ProductSuplyBean psb = new GoShopping.BLL.ProductSuplyBean();
        return psb.GetProductSuply(Convert.ToInt32(supplyerId)).Name;
    }
    public static string GetTypeName(object TypeId)
    {
        GoShopping.BLL.ProductTypeBean ptb = new GoShopping.BLL.ProductTypeBean();
        return ptb.GetProductType(Convert.ToInt32(TypeId)).TypeName;
    }
    public static string GetPrdtName(object obj)
    {
        GoShopping.BLL.ProductBean pb = new GoShopping.BLL.ProductBean();
        return pb.GetProduct(Convert.ToInt32(obj)).Name;
    }
    public static string ConvertBoolToString(object obj)
    {
        if (Convert.ToBoolean(obj))
        {
            return "是";
        }
        else
        {
            return "否";
        }
    }
    #region Get province,city and county name by id
    public static string GetProvinceName(object id)
    {
        GoShopping.BLL.SysInfo.AreaControl ac = new GoShopping.BLL.SysInfo.AreaControl();
        Province prov = new Province();
        prov = ac.GetProvinceByID(Convert.ToInt16(id));
        //prov = ac.GetProvinceByID(id);
        return prov.Name;
    }
    public static string GetCityName(object id)
    {
        GoShopping.BLL.SysInfo.AreaControl ac = new GoShopping.BLL.SysInfo.AreaControl();
        City ct = new City();
        //ct = ac.GetCityByID(id);
        ct = ac.GetCityByID(Convert.ToInt16(id));
        return ct.Name;
    }
    public static string GetCountyName(object id)
    {
        GoShopping.BLL.SysInfo.AreaControl ac = new GoShopping.BLL.SysInfo.AreaControl();
        County cty = new County();
        //cty = ac.GetCountyByID(id);
        cty = ac.GetCountyByID(Convert.ToInt16(id));
        return cty.Name;
    }
    #endregion
}
